<template>
  <div class="fade">
      <div class="f_head">{{msg.title}}</div>
      <div class="f_text">{{msg.text[0]}}<br>{{msg.text[1]}}</div>
      <div class="f_icon" :style="{'background-image': 'url('+ msg.img +')'}"></div>
      <div class="f_box" :class="{fadeIn : top < $parent.$parent.scrollTop}">
          <slot></slot>
      </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      top: 0
    };
  },
  props: ["msg"],
  mounted() {
    this.top = this.$el.children[3].offsetTop - window.innerHeight;
  }
};
</script>
<style scoped>
.fade {
  padding-top: 0.65rem;
  background-color: #fff;
  text-align: center;
}
.f_head {
  font-size: 0.36rem;
  margin-bottom: 0.36rem;
  font-weight: bold;
  color: #333;
}
.f_text {
  font-size: 0.28rem;
  color: #999;
  line-height: 0.5rem;
}
.f_icon {
  margin-top: 1.1rem;
  height: 1.82rem;
  width: 100%;
  background-size: auto 1.82rem;
  background-repeat: no-repeat;
  background-position: center center;
}
.f_box {
  position: relative;
  top: 0.7rem;
  transition: all 0.5s;
  opacity: 0.5;
  background-color: #fff;
}
.fadeIn {
  top: -0.36rem;
  opacity: 1;
  box-shadow: 0rem -0.04rem 0.06rem #ededed;
}
</style>
